package com.beacon.controller;

import com.beacon.model.Balance;
import com.beacon.service.BalanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;;
import org.springframework.web.bind.annotation.RestController;

/**
 * 编写者：冯庆虎
 * 编写时间：2019/05/21
 * 类模块描述：角色的查询及相关增删改查
 */
@RestController(value = "/Balance")//value值与数据库名称一致
public class BalanceController {
    @Autowired
    private BalanceService balanceService;

    @RequestMapping(value = "/getBalance")//value值为/get+数据库全名
    public String setDataStr(String str){
        return "你输入的名字叫："+str;
    }

    /*跨域访问*/
    @CrossOrigin

    @RequestMapping(value = "/getB")//value值为/get+(数据库首字母)
    public Balance getB(Integer bid){
        System.out.println("输入的数据为："+bid);
        return balanceService.selectByPrimaryKey(bid);
    }

    public void getLog(Balance balance){
        if(balance != null){
            balanceService.selectByPrimaryKey(balance.getBid());
        }
    }

}